package cn.apotato.dynamicdatascore.entity;

import lombok.Getter;

@Getter
public class Result<T> {
    private final Integer code;
    private final String msg;
    private final T data;

    public Result(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static <T> Result<T> ok(T data) {
        return new Result<>(200, "success", data);
    }

    public static <T> Result<T> error(String msg) {
        return new Result<>(500, msg, null);
    }
}
